<template>
  <div>修改用户信息{{id}}, 名称：{{name}}</div>
</template>

<script>
  export default {
    layout: "test",
    async asyncData() {
      var a = await new Promise(function (resolve, reject) {
        setTimeout(function () {
          resolve('a');
          console.log('a');
        }, 2000);
      });
      var b = await new Promise(function (resolve, reject) {
        setTimeout(function () {
          resolve('b');
          console.log('b');
        }, 1000);
      });
      return {
        name: "高志红"
      }
    },
    name: "",
    data() {
      return {
        id: '',
        name: ''
      }
    },
    methods: {
      getUser: function () {
        // ajax请求服务端的接口
        // this.name = "曹璐"
      },
      a: function () {
        return new Promise(function (resolve, reject) {
          setTimeout(function () {
            resolve('a');
          }, 2000);
        })
      },
      b: function () {
        return new Promise(function (resolve, reject) {
          setTimeout(function () {
            resolve('b');
          }, 1000);
        })
      }
    },
    mounted() {
      this.id = this.$route.params.id;
      this.getUser();
      // this.a().then(res => {
      //   alert(res);
      // });
      // this.b().then(res => {
      //   alert(res);
      // });
    }
  }
</script>

<style scoped>

</style>
